static void push_field_value(VEC(constructor_elt,gc) *v, const char *name, tree val);

static VEC(constructor_elt, gc) *start_field_construct(tree type, js_type jstype)
{
  VEC(constructor_elt, gc) *v = VEC_alloc(constructor_elt, gc, 0);
  CONSTRUCTOR_APPEND_ELT(v, TYPE_FIELDS(type), NULL);
  push_field_value(v, "type", js_build_int((int)jstype));
  return v;
}

static void push_field_value(VEC(constructor_elt,gc) *v, const char *name, tree val)
{
  constructor_elt *elt = VEC_last(constructor_elt, v);
  tree next = DECL_CHAIN(elt->index);
  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(elt->index)), name) == 0);
  elt->value = val;
  CONSTRUCTOR_APPEND_ELT(v, next, NULL);
}

static tree finish_field_construct(VEC(constructor_elt,gc) *v, tree type)
{
  tree entry;
  VEC_pop(constructor_elt, v);
  entry = build_constructor(type, v);
  TREE_CONSTANT(entry) = false;
  return entry;
}

/*
static tree convert_string_to_strobj(tree type, tree strcst)
{
  tree expr;
  VEC(constructor_elt, gc) *v;
  v = start_field_construct(type, JS_STRING);
  push_field_value(v, "length", js_build_int(TREE_STRING_LENGTH(strcst)));
  push_field_value(v, "__str" , expr);
  expr = finish_field_construct(v, type);
  return expr;
}
*/
